/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cw.biz;

import cw.controller.SubjectJpaController;
import cw.entity.Subject;
import java.util.List;

/**
 *
 * @author VinhTC
 */
public class SubjectBiz {
    SubjectJpaController sbjController = new SubjectJpaController();
    
    public SubjectBiz() {
    }

    /**
     * getLevelByName
     * @param sbjName
     * @return Subject
     */
    public Subject getSubjectByName(String sbjName) {
        try {
            return sbjController.getSubjectByName(sbjName);
        } catch (Exception e) {
            return null;
        }
    }

    /**
     * getLevelById
     * @param sbjId
     * @return
     */
    public Subject getSubjectById(int sbjId) {
        try {
            return sbjController.findSubject(sbjId);
        } catch (Exception e) {
            return null;
        }
    }

    /**
     * this method use to get all subject
     * @return- list Subject
     */
    public List<Subject> getAllSubject(){

        try {            
            return sbjController.findSubjectEntities();
            
        } catch (Exception e) {
            return null;
        }
    }
}
